using System.Collections.Generic;

namespace Commons.Parser.Actions
{
	public class ActionData
	{
		private string _name;
		private List<ActionData> _children;
		private Dictionary<string,string> _attributes;
		
		public ActionData(string name)
		{
			_name = name;
			_children = new List<ActionData>();
			_attributes   = new Dictionary<string, string>();
		}
		
		public void AddChild(ActionData data)
		{
			_children.Add(data);
		}
		
		public ActionData GetChildAt(int i)
		{
			return _children[i];
		}
		
		public int Count
		{
			 get { return _children.Count; } 
		}
		
		public string name
		{
			get { return _name; } 
		}
	
		public void AddAttribute(string key, string val)
		{
			_attributes[key] = val;
		}
		
		public Dictionary<string,string> GetAttributes()
		{
			return _attributes;
		}
		
		public bool IsSequential 
		{
			get { return _name == "sequential"; }
		}
		
		public bool IsConcurrent
		{
			get { return _name == "concurrent"; }
		}
	}
}
